#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
/*********Begin*********/
int main() {
    struct student {
        long number;
        char name[20];
        float score;
    }s1, s2;
    scanf("%ld %s %f", &s1.number, s1.name, &s1.score);
    scanf("%ld %s %f", &s2.number, s2.name, &s2.score);
    if (s1.score < s2.score) {
        printf("%ld %s %g", s2.number, s2.name, s2.score);
    }
    else {
        printf("%ld %s %g", s1.number, s1.name, s1.score);
    }
}



/*********End*********/